home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / awt / GraphicsDevice.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  3.8 KB  |  109 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)GraphicsDevice.java    1.14 98/05/04
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15.  
  16. package java.awt;
  17.  
  18. /**
  19.  * The <code>GraphicsDevice</code> class describes the graphics devices
  20.  * that might be available in a particular graphics environment.  These
  21.  * include screen and printer devices. Note that there can be many screens
  22.  * and many printers in an instance of {@link GraphicsEnvironment}. Each
  23.  * graphics device has one or more {@link GraphicsConfiguration} objects
  24.  * associated with it.  These objects specify the different configurations
  25.  * in which the <code>GraphicsDevice</code> can be used.  
  26.  * @see GraphicsEnvironment
  27.  * @see GraphicsConfiguration
  28.  * @version 10 Feb 1997
  29.  */
  30. public abstract class GraphicsDevice {
  31.     /**
  32.      * This is an abstract class that cannot be instantiated directly.
  33.      * Instances must be obtained from a suitable factory or query method.
  34.      * @see GraphicsEnvironment#getScreenDevices
  35.      * @see GraphicsEnvironment#getDefaultScreenDevice
  36.      * @see GraphicsConfiguration#getDevice
  37.      */
  38.     protected GraphicsDevice() {
  39.     }
  40.  
  41.     /**
  42.      * Device is a raster screen.
  43.      */
  44.     public final static int TYPE_RASTER_SCREEN        = 0;
  45.  
  46.     /**
  47.      * Device is a printer.
  48.      */
  49.     public final static int TYPE_PRINTER        = 1;
  50.  
  51.     /**
  52.      * Device is an image buffer.  This buffer can reside in device
  53.      * or system memory but it is not physically viewable by the user.
  54.      */
  55.     public final static int TYPE_IMAGE_BUFFER           = 2;
  56.     
  57.     /**
  58.      * Returns the type of this <code>GraphicsDevice</code>.
  59.      * @return the type of this <code>GraphicsDevice</code>, which can
  60.      * either be TYPE_RASTER_SCREEN, TYPE_PRINTER or TYPE_IMAGE_BUFFER.
  61.      * @see #TYPE_RASTER_SCREEN
  62.      * @see #TYPE_PRINTER
  63.      * @see #TYPE_IMAGE_BUFFER
  64.      */
  65.     public abstract int getType();
  66.  
  67.     /**
  68.      * Returns the identification string associated with this 
  69.      * <code>GraphicsDevice</code>.
  70.      * @return a <code>String</code> that is the identification
  71.      * of this <code>GraphicsDevice</code>.
  72.      */
  73.     public abstract String getIDstring();
  74.     
  75.     /**
  76.      * Returns all of the <code>GraphicsConfiguration</code>
  77.      * objects associated with this <code>GraphicsDevice</code>.
  78.      * @return an array of <code>GraphicsConfiguration</code>
  79.      * objects that are associated with this 
  80.      * <code>GraphicsDevice</code>.
  81.      */
  82.     public abstract GraphicsConfiguration[] getConfigurations();
  83.  
  84.     /**
  85.      * Returns the default <code>GraphicsConfiguration</code>
  86.      * associated with this <code>GraphicsDevice</code>.
  87.      * @return the default <code>GraphicsConfiguration</code>
  88.      * of this <code>GraphicsDevice</code>.
  89.      */
  90.     public abstract GraphicsConfiguration getDefaultConfiguration();
  91.  
  92.     /**
  93.      * Returns the "best" configuration possible that passes the
  94.      * criteria defined in the {@link GraphicsConfigTemplate}.
  95.      * @param gct the <code>GraphicsConfigTemplate</code> object
  96.      * used to obtain a valid <code>GraphicsConfiguration</code>
  97.      * @return a <code>GraphicsConfiguration</code> that passes
  98.      * the criteria defined in the specified
  99.      * <code>GraphicsConfigTemplate</code>.
  100.      * @see GraphicsConfigTemplate
  101.      */
  102.     public GraphicsConfiguration
  103.            getBestConfiguration(GraphicsConfigTemplate gct) {
  104.         GraphicsConfiguration[] configs = getConfigurations();
  105.         return gct.getBestConfiguration(configs);
  106.     }
  107.  
  108. }
  109.